package cn.itcast.Rainbow_self_mention.Dao;

import android.content.ContentValues;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

import cn.itcast.Rainbow_self_mention.Server.CountServer;

public class UserDao {
    SqlHelper hp ;

    public UserDao(Context context){
        hp=new SqlHelper(context);
    }
    public void DeleteUserData(){
        ContentValues values = new ContentValues();
        SQLiteDatabase db = hp.getWritableDatabase();
        values.put("username", "null");
        values.put("userphone", "null");
        values.put("userid", 0);
        db.update("logined", values, "_id=?", new String[]{1 + ""});
        db.delete("HISTORY", "_id!=?", new String[]{"1"});
        db.close();
    }
    public void PutUserData(String name,String userphone,int userid){
        ContentValues values = new ContentValues();
        SQLiteDatabase db = hp.getWritableDatabase();
        values.put("username", name);
        values.put("userphone", userphone);
        values.put("userid", userid);
        db.update("logined", values, "_id=?", new String[]{1 + ""});
        db.close();
    }

}
